package asteroids.model.programs.statements;

import exception.StopActionClassException;
import asteroids.model.programs.Expression;
import asteroids.model.programs.Program;

public class PrintStatement extends Statement {
	
	public PrintStatement(Expression<?> expression){
		this.expression=expression;
	}
	
	private Expression<?> expression;

	@Override
	public void execute(Program program) throws StopActionClassException {
		if(!isExecuted()){
		System.out.println(expression.getValue(program));
		setExecuted();
		}
	}

	@Override
	public void reset() {
		setUnexecuted();
	}

}
